package com.project.webservice.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.webservice.entity.RfidIcGjclManu;
import com.project.webservice.mapper.RfidIcGjclManuMapper;
import com.project.webservice.service.RfidIcGjclManuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Service
@DS("rfid")
public class RfidIcGjclManuServiceImpl extends ServiceImpl<RfidIcGjclManuMapper, RfidIcGjclManu> implements RfidIcGjclManuService {
    /**
     * 查询车牌号,电子标签号绑定信息
     * @param yhids
     * @return
     */
    public List<Map<String,String>> proGetTid(List<String> yhids){
        List<Map<String,String>> mapList = new ArrayList<>();
        if(CollUtil.isNotEmpty(yhids)){
            List<RfidIcGjclManu> list = super.list(Wrappers.<RfidIcGjclManu>lambdaQuery()
                    .in(RfidIcGjclManu::getYhid,yhids).like(RfidIcGjclManu::getCph,"沪"));
              if(CollUtil.isNotEmpty(list)){
                  list.forEach(item->{
                      Map<String,String> map = new HashMap<>();
                      map.put("IC_NO",item.getIcno());
                      map.put("CPH",item.getCph());
                      mapList.add(map);
                  });
              }
        }
        return mapList;
    }
}
